package com.wushijia.designpatterns.adapter;

import java.util.Enumeration;
import java.util.Iterator;

/**
 * description:枚举类迭代适配器
 *
 * @author yang
 * @date 2018/1/17 21:28
 */
public class EnumerationIterator implements Iterator {

  Enumeration enumeration;

  public EnumerationIterator(Enumeration enumeration) {
    this.enumeration = enumeration;
  }

  @Override
  public boolean hasNext() {
    return enumeration.hasMoreElements();
  }

  @Override
  public Object next() {
    return enumeration.nextElement();
  }

  @Override
  public void remove() {
    throw new UnsupportedOperationException();
  }
}
